﻿@{
    ViewBag.Title = "公司开户";
}

<div id="divCompany" v-cloak class="content">
    <div class="whiteBackgroundBox">
        <div class="NewContent">
            <h3><span>公司开户</span></h3>
            @* 顶部搜索 *@
            <div class="topbts">
                <div class="searchBox">
                    <em>公司名称</em>
                    <el-input v-model="search.name" clearable maxlength="20" size="small" style="width:180px;" placeholder="请输入公司名称"></el-input>
                    <em>管理员账号</em>
                    <el-input v-model="search.adminName" clearable maxlength="20" size="small" style="width:180px;" placeholder="请输入管理员账号"></el-input>
                    <em>状态</em>
                    <el-select v-model="search.statusType" placeholder="请选择" clearable size="small" style="width: 120px;">
                        <el-option v-for="item in statusTypeList" :key="item.id" :label="item.name" :value="item.id"></el-option>
                    </el-select>
                    <el-button type="primary" size="mini" style="margin:0 0 0 5px;" v-on:click="getList">搜索</el-button>
                </div>
                <el-button type="success" v-on:click="openDialog()" size="mini">新增信息</el-button>
                <div class="clear"></div>
            </div>

            <div class="newList">
                <el-table :data="company.list" style="width: 100%">
                    <el-table-column prop="name" label="公司名称"></el-table-column>
                    <el-table-column prop="adminName" label="管理员账号" width="150"></el-table-column>
                    <el-table-column label="类型" width="80">
                        <template slot-scope="scope">
                            <span v-if="scope.row.statusType==1">启用</span>
                            <span v-else>禁用</span>
                        </template>
                    </el-table-column>
                    <el-table-column prop="updateTime" label="修改日期" width="100" :formatter="formatColumn"></el-table-column>
                    <el-table-column prop="remark" label="备注" width="150"></el-table-column>
                    <el-table-column label="操作" width="180">
                        <template slot-scope="scope">
                            <el-link type="primary" v-on:click="openDialog(scope.row)" style="margin:0 10px 0 0;">修改</el-link>
                            <el-link type="primary" v-on:click="resetAdminPwd(scope.row.id)" style="margin:0 10px 0 0;">重置密码</el-link>
                            <el-link type="danger" v-on:click="delCompany(scope.row.id)">删除</el-link>
                        </template>
                    </el-table-column>
                </el-table>
                <div class="paging">
                    <el-pagination background layout="prev, pager, next"
                                   v-on:current-change="pageChange"
                                   :current-page="search.pageIndex"
                                   :total="company.total"
                                   :hide-on-single-page="true"></el-pagination>
                </div>
            </div>

        </div>
    </div>

    @* 弹层样式 *@

    <el-dialog :title="dialog.title" :visible.sync="dialog.show" width="800px" v-bind:close-on-click-modal="false">
        <el-form v-bind:model="dialog.form" v-bind:rules="rules" ref="dialog.form" label-width="100px" class="demo-ruleForm" size="small" >
            <ul class="formList">
                <li class="long">
                    <el-form-item label="公司名称" prop="name">
                        <el-input style="width:100%;" v-model="dialog.form.name" maxlength="50" placeholder="请输入公司名称" autocomplete="off"></el-input>
                    </el-form-item>
                </li>
                <li class="long">
                    <el-form-item label="管理员账号" prop="adminName">
                        <template v-if="dialog.form.Id>0">
                            <el-input style="width:300px;" v-model="dialog.form.adminName" disabled maxlength="20" placeholder="请输入管理员账号(手机号)" autocomplete="off"></el-input>
                            <em style="margin-left: 50px; font-size: 13px; color: #6e4242;">管理员账号不能修改</em>
                        </template>
                        <el-input style="width:100%;" v-model="dialog.form.adminName" v-else maxlength="20" placeholder="请输入管理员账号(手机号)" autocomplete="off"></el-input>
                    </el-form-item>
                </li>
                <li class="long">
                    <el-form-item label="状态" prop="statusType">
                        <el-select v-model="dialog.form.statusType" placeholder="请选择状态" clearable size="small" style="width: 120px;">
                            <el-option v-for="item in statusTypeList" :key="item.id" :label="item.name" :value="item.id"></el-option>
                        </el-select>
                        <em style="margin-left: 100px; font-size: 13px; color: #6e4242;">默认密码：666888</em>
                    </el-form-item>
                </li>
                <li class="long">
                    <el-form-item label="备注">
                        <el-input style="width:100%;" v-model="dialog.form.remark" maxlength="50" placeholder="请输入备注" autocomplete="off"></el-input>
                    </el-form-item>
                </li>
            </ul>
        </el-form>
        <div class="clear"></div>
        <div slot="footer" class="dialog-footer">
            <el-button v-on:click="dialog.show = false">取 消</el-button>
            <el-button type="primary" v-on:click="saveCompany('dialog.form')">确 定</el-button>
        </div>
    </el-dialog>
</div>
@section scripts
    {
    <script src="~/lib/ueditor/ueditor.config.js"></script>
    <script src="~/lib/ueditor/ueditor.all.min.js"></script>
    <script src="~/lib/ueditor/lang/zh-cn/zh-cn.js"></script>
    <script src="~/js/modules/company/index.js" asp-append-version="true"></script>
}